<?php
    /**
     *  
     */
    class UserPermissionCategoryLink extends BaseModel
    {

        protected $_id;
        protected $_userId;
        protected $_categoryId;

        /**
         *  讀取資料表而產生, 請視同cache, 任何情況下皆不可更動該產生的內容
         *  @return Array()
         */
        public static function getTableDefinition()
        {
        }

        /**
         *  經資料表傳至程式中時所對應的 method 資訊
         *  @return Array()
         */
        public static function getTableFields()
        {
            return Array(
                "id"          => "getId",
                "user_id"     => "getUserId",
                "category_id" => "getCategoryId"
            );
        }

        /**
         *  reset to default value model
         *  @return Array()
         */
        public function resetValue() {
            $this->__sleep();
            $this->setId         ( -1 );
            $this->setUserId     ( 0 );
            $this->setCategoryId ( 0 );
        }

        /**
         *  validate model data
         *  @return messages Array()
         */
        public function validate()
        {
            $validateInfo = parent::validate();

            return $validateInfo;
        }

        /**
         *  filter model data
         */
        public function filter()
        {
            $this->setUserId               ( (int) $this->getUserId() );
            $this->setCategoryId           ( (int) $this->getCategoryId() );
        }

        /* ------------------------------------------------------------------------------------------------------------------------
            basic method 
        ------------------------------------------------------------------------------------------------------------------------ */


        /**
         *  get UserId 
         *  @return int
         */
        public function getUserId()
        {
            return $this->_userId;
        }
        /**
         *  set UserId
         */
        public function setUserId( $userId )
        {
            $this->_userId = (int) $userId;
        }

        /**
         *  get CategoryId 
         *  @return int
         */
        public function getCategoryId()
        {
            return $this->_categoryId;
        }
        /**
         *  set CategoryId
         */
        public function setCategoryId( $categoryId )
        {
            $this->_categoryId = (int) $categoryId;
        }


        /* ------------------------------------------------------------------------------------------------------------------------
            extends
        ------------------------------------------------------------------------------------------------------------------------ */
        /**
         *  clear extends information
         */
        public function __sleep()
        {
            return parent::__sleep();
        }

    }

